import Command from "../enum/Command.js"
import BufferTool from "../tool/BufferTool.js"


export default class TreeConnectAgree {

  static command = Command.TREE_CONNECT
  static structure = {
    request: [
        ['StructureSize', 2, 9],
        ['Reserved', 2, 0],
        ['PathOffset', 2, 72],
        ['PathLength', 2],
        ['Buffer', 'PathLength', (connectObj)=>{
          return Buffer.from("\\\\192.168.2.154\\IPC$", 'ucs2')
        }],
      ],
    
      response: [
        ['StructureSize', 2],
        ['ShareType', 1],
        ['Reserved', 1],
        ['ShareFlags', 4],
        ['Capabilities', 4],
        ['MaximalAccess', 4],
      ],
  }


  constructor(){
  }

  static onRequest(){
  }

  static onResponse(connectObj, message){
    console.log("收到的TreeId", message.headerStrucFormat.TreeId)
    connectObj.treeId = message.headerStruc.TreeId;
  }

}